﻿<UserControl x:Class="StockAnalyst2.Plugins.Visualization.Historical.ResultChart"
			 x:ClassModifier="internal"
			 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	         mc:Ignorable="d" 
				 
			 xmlns:Charts="clr-namespace:Visiblox.Charts;assembly=Visiblox.Charts"
             xmlns:Historical="clr-namespace:StockAnalyst2.Plugins.Visualization.Historical" 
			 
			 Background="#1F1F1F" 
			 
			 d:DesignWidth="1000"
			 d:DataContext="{d:DesignInstance Type=Historical:ResultChartVM}" >

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="..\..\..\StockAnalystTheme.xaml" />
			</ResourceDictionary.MergedDictionaries>
			
			<Style x:Key="LegendStyle" TargetType="Charts:Legend" >
				<Setter Property="Foreground" Value="{StaticResource FontBrush}" />
			</Style>

			<!-- Crosshair -->
			<Style TargetType="Charts:Crosshair" x:Key="CrosshairStyle" >
				<Setter Property="Foreground" Value="#111111" />
				<Setter Property="Background" Value="#AAAAAA" />
			</Style>

			<ControlTemplate TargetType="Charts:Crosshair" x:Key="CrosshairTemplate">
				<Canvas>
					<Line Stroke="#D7D7D7" StrokeThickness="1" X1="{TemplateBinding X}" X2="{TemplateBinding X}" Y1="0" Y2="5000" />
					<Line Stroke="#D7D7D7" StrokeThickness="1" Y1="{TemplateBinding Y}" Y2="{TemplateBinding Y}" X1="0" X2="5000" />
					<Border CornerRadius="5" Background="#D7D7D7" Canvas.Top="{TemplateBinding Y}" Canvas.Left="{TemplateBinding X}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="2" Margin="5" >
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition />
								<RowDefinition />
							</Grid.RowDefinitions>
							<TextBlock Grid.Row="0" Grid.Column="0" Margin="3,1,1,1" Text="Y: " Foreground="Black" FontWeight="Bold" />
							<TextBlock Grid.Row="0" Grid.Column="1" Margin="1,1,3,1" Text="{TemplateBinding FormattedYValue}" />
							<TextBlock Grid.Row="1" Grid.Column="0" Margin="3,1,1,2" Text="X: " Foreground="Black" FontWeight="Bold" />
							<TextBlock Grid.Row="1" Grid.Column="1" Margin="1,1,3,2" Text="{TemplateBinding FormattedXValue}"  />
						</Grid>
					</Border>
				</Canvas>
			</ControlTemplate>
		</ResourceDictionary>
	</UserControl.Resources>

	<Expander IsExpanded="True">
		<Expander.HeaderTemplate>
			<DataTemplate>
				<TextBlock Foreground="{StaticResource FontBrush}" Text="Results" FontWeight="Bold" Margin="9,3,3,3" />
			</DataTemplate>
		</Expander.HeaderTemplate>
		<Charts:Chart LegendTitle="Series" LegendStyle="{StaticResource LegendStyle}" LegendPosition="InsideTopRight" x:Name="Chart" >
			<Charts:Chart.Resources>
				<Style x:Key="WhiteLine" TargetType="Line" >
					<Setter Property="Stroke" Value="{StaticResource FontBrush}" />
				</Style>
				
				<Style x:Key="DarkLine" TargetType="Line" >
					<Setter Property="Stroke" Value="#3F3F3F" />
				</Style>
			</Charts:Chart.Resources>
			<Charts:Chart.YAxis>
				<Charts:LinearAxis AutoScaleToVisibleData="True" IsAutoMarginEnabled="True" Foreground="{StaticResource FontBrush}" MajorTickStyle="{StaticResource WhiteLine}" ShowMinorGridlines="False" ShowMinorTicks="False" MajorGridlineStyle="{StaticResource DarkLine}" />
			</Charts:Chart.YAxis>
			<!--<Charts:Chart.SecondaryYAxis>
				<Charts:LinearAxis AutoScaleToVisibleData="True" IsAutoMarginEnabled="True" Foreground="{StaticResource FontBrush}" ShowMajorTicks="True" ShowMinorTicks="False" ShowMajorGridlines="False" ShowMinorGridlines="False" />
			</Charts:Chart.SecondaryYAxis>-->
			<Charts:Chart.XAxis>
				<Charts:DateTimeAxis AutoScaleToVisibleData="True" IsAutoMarginEnabled="True" Foreground="{StaticResource FontBrush}" MajorTickStyle="{StaticResource WhiteLine}" ShowMinorGridlines="False" ShowMinorTicks="False" MajorGridlineStyle="{StaticResource DarkLine}" />
			</Charts:Chart.XAxis>
			<Charts:Chart.Series>
				<Charts:ColumnSeries DataSeries="{Binding DailyPartials}" HighlightingEnabled="True" SelectionMode="Series" PointFill="#FF71FF" /> <!--YAxis="{Binding SecondaryYAxis, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Charts:Chart}}}"-->
				<Charts:LineSeries DataSeries="{Binding AccumulatedOperationPartials}" HighlightingEnabled="True" SelectionMode="Series" LineStroke="#0080C0" LineStrokeThickness="2" />
				<Charts:LineSeries DataSeries="{Binding EMAResult}" HighlightingEnabled="True" SelectionMode="Series" LineStroke="#008000" /> <!--YAxis="{Binding SecondaryYAxis, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Charts:Chart}}}"-->
			</Charts:Chart.Series>
			<Charts:Chart.Behaviour>
				<Charts:BehaviourManager AllowMultipleEnabled="True" >
					<Charts:ZoomBehaviour BehaviourActivator="Alt" RestrictZoomOutToInitialRange="True" AnimationEnabled="False" />
					<Charts:PanBehaviour BehaviourActivator="Control" AllowPanBeyondData="False" />
					<Charts:CrosshairBehaviour BehaviourActivator="Shift" HideCollidingAxisLabels="True" CrosshairTemplate="{StaticResource CrosshairTemplate}" CrosshairStyle="{StaticResource CrosshairStyle}" />
				</Charts:BehaviourManager>
			</Charts:Chart.Behaviour>
		</Charts:Chart>
	</Expander>
</UserControl>
